package com.gmail.bloim.serg.acmbuilder;

import com.sun.javaws.exceptions.InvalidArgumentException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.io.IOException;

/**
 * User: Администратор
 * Date: 26.04.13
 * Time: 12:22
 */
public class Program {
    private final File builderDescriptorFile;

    public Program(File builderDescriptorFile) {
        this.builderDescriptorFile = builderDescriptorFile;
    }

    public static void main(String[] args) throws InvalidArgumentException {
        try {
            File buildDescriptor = new File("acm-build.xml");
            JAXBContext context = JAXBContext.newInstance(BuildConfiguration.class);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            BuildConfiguration config = (BuildConfiguration) unmarshaller.unmarshal(buildDescriptor);
            SimpleConfigurableBuilder builder = new SimpleConfigurableBuilder(config);
            builder.build();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
